package com.dongan.controller;

import com.dongan.pojo.Menus;
import com.dongan.service.MenusService;
import com.dongan.service.impl.MenusServiceImpl;
import com.dongan.utils.ResultResponseUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 菜单表 前端控制器
 * </p>
 *
 * @author longTao
 * @since 2021-06-15
 */
@RestController
@RequestMapping("/menus")
@CrossOrigin
public class MenusController {

    @Autowired
    private MenusService menusService;

    /**
     * 根据角色id查询出它的菜单
     * @param id
     * @return
     */
    @RequestMapping(value = "/queryMenuByRole/{id}",method = RequestMethod.GET)
    public ResultResponseUtil queryMenuByRole(@PathVariable String id){
        List<Menus> menusList = menusService.queryMenu(Long.valueOf(id));
        return new ResultResponseUtil(menusList);
    }
}

